/**
 * 
 */
requirejs.config({
    baseUrl:'http://static.auoffice.com/static/js' ,
    waitSeconds: 0,
    paths: {
    	jquery:'libs/jquery.min',
        datatables: 'libs/dataTables/jquery.dataTables.min',
        btdatatables: 'libs/dataTables/dataTables.bootstrap.min',
        //plugins
        base: 'common/base',
    },
    shim: {
        'datatables': {
            deps: ['jquery'],
            exports: 'datatables'
        },
        'btdatatables': {
            deps: ['jquery'],
            exports: 'btdatatables'
        }, 
    }
});

require([
        'jquery',
     	'common/base',
     	'datatables',
     	'btdatatables'
    ],
    function($,base) {
        var table = $("#data_table").DataTable({
            "searching": true,
            "processing": true,
            "serverSide": true,
            "ordering": false,
            "deferRender": true,
            "ajax": {
                "url": '/icon/icon/list/',
                "type": "POST"
            },
            "columnDefs": [
                {
                   "targets": 0,
                   "data": null,
                   "name": null,
                   "searchable": false,
                   "bSortable": false,
                   "render": function (data, type, full) {
                       var html = '<input type="checkbox" name="user_id" data-id="'+full.id+'"/>';
                       return html;
                   }
                },
                {
                    "targets": 1,
                    "data": "name",
                    "name": "name",
                    "searchable": false,
                    "bSortable": false
                },
                {
                	"targets": 2,
                	"data": null,
                	"name": null,
                	"searchable": false,
                	"bSortable": false,
                    "render": function (data, type, full) {
                        var html = '<span class="'+full.css_class+'" aria-hidden="true"></span>';
                        return html;
                    }
                },
                {
                	"targets": 3,
                	"data": "remark",
                	"name": "remark",
                	"searchable": false,
                	"bSortable": false
                }
            ],
            "oLanguage": {
                "sLengthMenu": '每页显示 _MENU_条 &nbsp;',
                "sZeroRecords": "没有找到符合条件的数",
                "sProcessing": "加载中...",
                "sInfo": "当前第 _START_ - _END_ 条　共计 _TOTAL_ 条",
                "sInfoEmpty": "木有记录",
                "sInfoFiltered": "(从 _MAX_ 条记录中过滤)",
                "sSearch": "搜索：",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "«",
                    "sNext": "»",
                    "sLast": "尾页"
                }
            }
        });
	});